﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;

namespace WebApplication1
{
    public class DbHelper
    {
        private static readonly string constring = "server=.;database=CMS;uid =sa;pwd=123456;";
        public static DataTable GetDatatable(string sql)
        {
            SqlDataAdapter adapter = new SqlDataAdapter(sql,constring);
            DataTable dt = new DataTable();
            adapter.Fill(dt);
            return dt;
        }
        public static void add(string sql)
        {
            SqlConnection connection = new SqlConnection(constring);
            SqlCommand command = new SqlCommand(sql, connection);
            connection.Open();
            command.ExecuteNonQuery();
            connection.Close();

        }

    }
}